package com.dx.mes.service.webservice.service;

import static com.dx.mes.common.bean.def.GenericDef.RETURN_CODE_UNKNOWN;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.dx.mes.common.transcoder.util.AppContext;
import com.dx.mes.common.transcoder.util.JacksonUtil;
import com.dx.mes.common.transcoder.util.LogUtils;
import com.dx.mes.common.transcoder.util.MqOpe;
import com.dx.mes.common.transcoder.util.Util;
import com.dx.mes.facade.webservice.service.IFepfqcrptService;
import com.dx.mes.facade.webservice.tx.Base.BaseO;

/**
 * FQC接口处理class
 * @author Vincent
 *
 */
@Service("fepfqcrptService")
public class FepfqcrptService implements IFepfqcrptService{

	private LogUtils logUtils;
	@Resource
	private MqOpe mqOpe;


	@Override
	public String subMainProc(String evt_no, String strInTrx) {
		AppContext.clear();
		AppContext.setCurrServiceName(FepfqcrptService.class.getSimpleName());
		AppContext.setCurrEventNumber(evt_no);
		logUtils = new LogUtils(FepfqcrptService.class);
		logUtils.info("[InTrx:" + strInTrx + "]");
		String strOutTrx="";
		BaseO outTrx = new BaseO();
		try {
			outTrx = transToErpProc(strInTrx);
		} catch (Exception ex) {
			outTrx.setRtn_code(RETURN_CODE_UNKNOWN);
			outTrx.setRtn_mesg(ex.toString());
			logUtils.error(Util.stackTraceToString(ex));
		} finally {
			strOutTrx = JacksonUtil.toJSONStr(outTrx);
			logUtils.info("[OutTrx:" + strOutTrx + "]");
		}
		return strOutTrx;
	}
	
	public BaseO transToErpProc(String strInTrx) throws Exception {
		BaseO outTrx = new BaseO();

		//TODO
		return outTrx;
	}
}
